package net.boyandi.picback;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JLabel;
import javax.swing.JOptionPane;

/**
 * @author Ilya Boyandin
 */
public class AboutAction extends AbstractAction {

    private static final long serialVersionUID = 8061547564979437216L;
    private final PicBack app;

    public AboutAction(PicBack app) {
        this.app = app;
        
        putValue(Action.NAME, "About");
//        putValue(Action.SMALL_ICON, PicBack.);
        putValue(Action.SHORT_DESCRIPTION, "About");
        putValue(Action.LONG_DESCRIPTION, "About this application");
        putValue(Action.ACTION_COMMAND_KEY, "about-command");     
    }

    public void actionPerformed(ActionEvent e) {
        JOptionPane.showMessageDialog(
                app,
                new JLabel(
                    "<html>" +
                    "<table>" +
                        "<tr><th colspan=2 style=\"font-size:15px;font-weight:bold\">Picback " + PicBack.VERSION + "</td></tr>" +
                        "<tr><td colspan=2><hr></tr>" +
                        "<tr>" +
                            "<td>" +
                                "A tool for Picasa users for making backups  " +
                                "of photo albums <br> and saving disk space." +
                            "</td>" +
                        "</tr>" +
                        "<tr><td colspan=2><hr></tr>" +
                        "<tr>" +
                            "<td align=center style=\"color:#777777\">" +
                                "Developed by Ilya Boyandin" +
                            "</td>" +
                        "</tr>" +
                     "</table>"
                ),
                "About",
                JOptionPane.PLAIN_MESSAGE,
                null
        );
    }

}
